<template>
	<view class="index_box">
		<textarea name="" id="" v-model='value' cols="" rows="" :placeholder="$t('message.qsyydh')">
			
		</textarea>
		
		<view class="indexx_button_box">
			<button class="indexx_button_box_one" @click="chognzhi()">
				
				<image src="https://9288rus.com.82.kssite.cn/uploads/20240417/86117b6b026782deebcc1bd0d0efffdb.png" mode=""></image>
				
				{{ $t("message.cz") }}
			</button>
			
				<button @click="caixun()">
					<image src="https://9288rus.com.82.kssite.cn/uploads/20240417/540167c5dfb2f05f47a3d248e2753a89.png" mode=""></image>
					
					
					{{ $t("message.cx") }}
				</button>
			
			
		</view>
		<view class="" v-for="(item,index) in order_data" :key='index' style="margin-bottom: 40rpx;">
			<view class="index_items"  v-if="show">
				<view class="index_items_top">
					{{ $t("message.ydh") }}：{{item.number}}
					<text v-if="langs=='en'">
						{{item.status_ru}}
					</text>
					<text v-else>
						{{item.status_text}}
					</text>
				</view>
				<view class="index_items_bottom">
					<view class="index_items_bottom_h2">
						{{item.product_name}}
					</view>
					<view class="index_items_bottom_text">
						<view class="">
							{{ $t("message.fjr")}}：{{item.addresser}}
						</view>
						<view class="">
							{{ $t("message.fhrq")}}：{{item.delivery_date}}
						</view>
					</view>
				</view>
				<view class="right">
			
				<button class="index_items_button" @click="de(item.id)">
					{{ $t("message.ckxq")}}
				</button>
					</view>
			</view>
			
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value:'',
				show:false,
				order_data:[],
				langs:''
			}
		},
		onShow() {
			let _this=this
			this.get_alllist()
			if(uni.getStorageSync('lang')=='en'){
				uni.setNavigationBarTitle({
				    title: "Запрос по накладной"
				});
				_this.langs='en'
			}
			if(uni.getStorageSync('lang')=='en'){
				uni.setTabBarItem({
				      index: 1,
				      text: _this.$t('message.table.my')
				});
				uni.setTabBarItem({
				      index: 0,
				      text: _this.$t('message.table.index')
				});
			}else{
				uni.setTabBarItem({
				      index: 1,
				      text: _this.$t('我的')
				});
				uni.setTabBarItem({
				      index: 0,
				      text: _this.$t('首页')
				});
			}
		},
		methods: {
			// 重置
			chognzhi(){
				let _this=this
				_this.value=''
				_this.show=false
			},
			// 跳转详情
			de(uid){
				uni.navigateTo({
					url:'/pages/Movement tracking/Movement tracking?id='+ uid
				})
			},
			//全部订单查询
			get_alllist(){
				let _this=this
				uni.$u.http.post('/api/order/list', {
				}).then(res => {
					if(res.code==1 && res.data!= '' ){
						_this.show=true
						_this.order_data=res.data
						console.log(_this.order_data)
					}
					
				}).catch(err => {
				    // uni.showToast({
				    //         icon: 'none',
				    //         title: err.msg
				    // })
				})
			},
			// 查询
			caixun(){
				let _this=this
				uni.$u.http.post('/api/order/search', {
				    number: this.value,
				}).then(res => {
					if(res.code==1){
						_this.show=true
						_this.order_data=[]
						_this.order_data.push(res.data)
					}
					uni.showToast({
					        icon: 'none',
					        title: res.msg
					})
				}).catch(err => {
                    uni.showToast({
                            icon: 'none',
                            title: err.msg
                    })
                })
			}
		}
	}
</script>

<style  lang="less">
	.index_box{
		min-height: 100vh;
		background: linear-gradient(0deg, #F9F9F9, #DCF0E3);
		padding:30rpx 70rpx 0 ;
		textarea{
			background: #ffffff;
			padding: 29rpx 57rpx;
			box-shadow: 0px 2rpx 10rpx 0rpx rgba(0,0,0,0.06);
			border-radius: 20rpx;
			box-sizing: border-box;
			height: 200rpx;
			width: 100%;
			outline: none;
		}
	}
	.indexx_button_box{
		display: flex;
		align-items: center;
		justify-content: center;
		margin: 40rpx 0 36rpx;
		button{
			white-space:nowrap;
			min-width: 200rpx;
			min-height: 75rpx;
			background: #01653B;
			box-shadow: 0px 2rpx 24rpx 0px rgba(1,101,59,0.4), 0px 1px 10px 0px rgba(255,255,255,0.5);
			border-radius: 10rpx;
			margin: 0 ;
			border: 4rpx solid #FFFFFF;
			font-weight: 400;
			font-size: 32rpx;
			color: #FFFFFF;
			display: flex;
			align-items: center;
			justify-content: center;
			image{
				width: 40rpx;
				margin-right: 11rpx;
				height: 40rpx;
			}
		}
	}
	.indexx_button_box_one{
			background: #F77F0A !important;
			margin-right: 58rpx !important;
			
	}
	.index_items{
		background: #FFFFFF;
		border-radius: 10px;
		box-sizing: border-box;
		padding: 30rpx 8rpx;
	}
	.index_items_top{
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 20rpx 27rpx;
		border-bottom: 2rpx solid #F7F7F9;
		font-weight: normal;
		font-size: 28rpx;
		color: #797979;
		text{
			font-weight: 400;
			font-size: 26rpx;
			color: #01653B;
		}
	}
	.index_items_bottom{
		padding: 30rpx 12rpx;
		border-bottom: 2rpx solid #F7F7F9;
		margin-bottom: 30rpx;
	}
	.index_items_bottom_h2{
		font-weight: bold;
		font-size: 30rpx;
		color: #01653B;
		margin-bottom: 29rpx;
	}
	.index_items_bottom_text>view{
		font-weight: 400;
		font-size: 26rpx;
		color: #333333;
		line-height: 48rpx;
	}
	.right{
		display: flex;
		justify-content: flex-end;
	}
	.index_items_button{
		min-width: 170rpx;
		white-space: nowrap;		
		border-radius: 30rpx;
		border: 2rpx solid #01653B;
		font-weight: normal;
		font-size: 26rpx;
		color: #01653B;
		background: #ffffff;
		display: inline-block;
		margin: 0 ;
		// margin-left: calc(100% - 170rpx);
	}
</style>
